package com.terrynoya.fight.data.parser.sff
{
	import flash.utils.Endian;
	import flash.utils.ByteArray;
	/**
	 * @author acer
	 */
	public class Bytes
	{
		private var _length:int;
		
		private var _data:ByteArray;
		
		public function Bytes(length:int,endian:String = Endian.LITTLE_ENDIAN):void
		{
			this._length = length;
			this._data = new ByteArray();
			this._data.endian = endian;
		}

		public function write(source:ByteArray,offset:int = 0) : void
		{
			if(offset != 0)
			{
				source.position = offset;
			}
			source.readBytes(this._data, this._data.length, this._length);
		}

		public function get data() : ByteArray
		{
			return _data;
		}
	}
}
